package com.study.scala.oop.element

abstract class Element {
  def contents: Array[String]
  def height: Int = contents.length
  def width: Int = if (height == 0) 0 else contents(0).length()
}

class ArrayElement(conts: Array[String]) extends Element {
  def contents: Array[String] = conts;
}

class LineElement(s:String) extends ArrayElement(Array(s)) {
 override def height: Int = 0
 override def width:Int = s.length()
}

object ElementTest{
  def main(args: Array[String]): Unit = {
    val ae=new ArrayElement(Array("hello","world"))
    println(ae.height)
     println(ae.width)
  }
}
